/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: ComCfg.h
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: Com
*
*******************************************************************************/

#ifndef COMCFG_H
#define COMCFG_H

/** HEADER FILES **/
#include "ComType.h"
#include "ComRte.h" 


/** MACRO DEFINITION **/
#define ComConf_ComRxPduCfg_Pdu_Other_Can1_0x201 PduRConf_ComRxPdu_Other_Can1_201
#define ComConf_ComRxPduCfg_Pdu_Other_Can2_0x202 PduRConf_ComRxPdu_Other_Can2_202
#define ComConf_ComRxPduCfg_Pdu_Max (2u)

#define ComConf_ComTxPduCfg_Pdu_YT_Can1_0x101 PduRConf_ComTxPdu_YT_Can1_0x101
#define ComConf_ComTxPduCfg_Pdu_YT_Can2_0x102 PduRConf_ComTxPdu_YT_Can2_0x102
#define ComConf_ComTxPduCfg_Pdu_Max (2u)

#define ComConf_ComTxSignalCfg_Signal_YT_Can1_First (0u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can1_SignalA_Motorola (0u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can1_SignalB_Intel (1u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can1_SignalC_Motorola (2u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can1_SignalD_Intel (3u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can1_Max (4u)

#define ComConf_ComTxSignalCfg_Signal_YT_Can2_First (4u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can2_SignalA (4u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can2_SignalB (5u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can2_SignalC (6u)
#define ComConf_ComTxSignalCfg_Signal_YT_Can2_Max (3u)

#define ComConf_ComTxSignalCfg_Signal_Max (7u)

#define ComConf_ComRxSignalCfg_Signal_Other_Can1_First (0u)
#define ComConf_ComRxSignalCfg_Signal_Other_Can1_SignalA_Motorola (0u)
#define ComConf_ComRxSignalCfg_Signal_Other_Can1_SignalB_Intel (1u)
#define ComConf_ComRxSignalCfg_Signal_Other_Can1_SignalC_Motorola (2u)
#define ComConf_ComRxSignalCfg_Signal_Other_Can1_SignalD_Intel (3u)
#define ComConf_ComRxSignalCfg_Signal_Other_Can1_Max (4u)

#define ComConf_ComTxSignalCfg_Signal_Other_Can2_First (4u)
#define ComConf_ComTxSignalCfg_Signal_Other_Can2_SignalA (4u)
#define ComConf_ComTxSignalCfg_Signal_Other_Can2_SignalB (5u)
#define ComConf_ComTxSignalCfg_Signal_Other_Can2_Max (2u)

#define ComConf_ComRxSignalCfg_Signal_Max (6u)


#define COM_SIGNAL_TYPE_BOOLEAN (0u) /* ComSignalType: BOOLEAN */
#define COM_SIGNAL_TYPE_UINT8 (1u) /* ComSignalType: UINT8 */
#define COM_SIGNAL_TYPE_UINT16 (2u) /* ComSignalType: UINT16 */
#define COM_SIGNAL_TYPE_UINT32 (3u) /* ComSignalType: UINT32 */
#define COM_SIGNAL_TYPE_UINT64 (4u) /* ComSignalType: UINT64 */
#define COM_SIGNAL_TYPE_SINT8 (5u) /* ComSignalType: SINT8 */
#define COM_SIGNAL_TYPE_SINT16 (6u) /* ComSignalType: SINT16 */
#define COM_SIGNAL_TYPE_SINT32 (7u) /* ComSignalType: SINT32 */
#define COM_SIGNAL_TYPE_FLOAT32 (8u) /* ComSignalType: FLOAT32 */
#define COM_SIGNAL_TYPE_FLOAT64 (9u) /* ComSignalType: FLOAT64 */
#define COM_SIGNAL_TYPE_UINT8_N (10u) /* ComSignalType: UINT8_N */
#define COM_SIGNAL_TYPE_UINT8_DYN (11u) /* ComSignalType: UINT8_DYN */

#define COM_SIGNAL_LITTLE_ENDIAN (0u) /* ComSignalEndianness: LITTLE_ENDIAN */
#define COM_SIGNAL_BIG_ENDIAN (1u) /* ComSignalEndianness: BIG_ENDIAN */


#define COM_IPDU_DIRECTION_SEND (0u) /* ComIPduDirection: SEND */
#define COM_IPDU_DIRECTION_RECEIVE (1u) /* ComIPduDirection: RECEIVE */

#define COM_IPDU_TYPE_NORMAL (0u) /* ComIPduType: NORMAL */
#define COM_IPDU_TYPE_TP (1u) /* ComIPduType: TP */

#define COM_IPDU_TX_CLEAR_UPDATE_BIT_CONFIRMATION (0u) /* ComTxIPduClearUpdateBit : Confirmation */
#define COM_IPDU_TX_CLEAR_UPDATE_BIT_TRANSMIT (1u) /* ComTxIPduClearUpdateBit : Transmit */
#define COM_IPDU_TX_CLEAR_UPDATE_BIT_TRIGGERTRANSMIT (2u) /* ComTxIPduClearUpdateBit : TriggerTransmit */

#define COM_TX_MODE_NONE (0u) /* ComTxModeMode: NONE */
#define COM_TX_MODE_DIRECT (1u) /* ComTxModeMode: DIRECT */
#define COM_TX_MODE_PERIODIC (2u) /* ComTxModeMode: PERIODIC */
#define COM_TX_MODE_MIXED (3u) /* ComTxModeMode: MIXED */



/** TYPEDEF DEFINITION **/
typedef uint8 Com_ConfigType;


typedef struct
{
    uint8 bitPosition; /* ComBitPosition */
    uint8 bitSize;/* ComBitSize */
    uint8 signalLength;/* ComSignalLengt */
    uint32 signalInitValue; /* ComSignalInitValue */
    uint8 comHandleId;/* ComHandleId */
    uint8 signalType; /* ComSignalType */
    uint8 signalEndianness; /* ComSignalEndianness */
    uint8* signalBufferPtr;  /* Start Byte position   in the signal buffer */
    
}Com_SignalConfigType;


typedef struct
{
    uint8 timePeriod  ; /* ComTxModeTimePeriod */
    uint8 timeOffset; /* ComTxModeTimeOffset */
    uint8 mode; /* ComTxModeMode */
}Com_TxModeType;


typedef struct
{
    uint8 unusedAreasDefault; /* ComTxIPduUnusedAreasDefault  */
    uint8 minimumDelayTime; /* ComMinimumDelayTime */
    uint8 txIPduClearUpdateBit; /* ComTxIPduClearUpdateBit */
    Com_TxModeType txMode; /* Com_TxMode */
}Com_TxIPduConfigType;


typedef struct
{
    Com_SignalConfigType* signalPtr; /* ComIPduSignalRef */
    uint8 signalNumber;
    PduIdType pduId;/* ComIPduHandleId */
    uint8* pduPtr; /* ComPduIdRef */
    uint8 comIPduType; /* ComIPduType  */
    Com_TxIPduConfigType comTxIPdu; /* comTxIPdu  */
}Com_PduConfigType;


/** LOCAL DATA DEFINITION **/
extern uint8 Com_TxPduBuffer_YT_Can1[8];
extern uint8 Com_TxPduBuffer_Can1[8];

extern uint8 Com_RxPduBuffer_Can0[8];
extern uint8 Com_RxPduBuffer_Can1[8];


extern const Com_SignalConfigType Com_TxSignal[ComConf_ComTxSignalCfg_Signal_Max];
extern const Com_SignalConfigType Com_RxSignal[ComConf_ComRxSignalCfg_Signal_Max];


extern const Com_PduConfigType Com_TxPduConfig[ComConf_ComTxPduCfg_Pdu_Max];
extern const Com_PduConfigType Com_RxPduConfig[ComConf_ComRxPduCfg_Pdu_Max];


#endif
